"""


"""
from itsdangerous import TimedJSONWebSignatureSerializer


def encrypt(openid):

    s1 = TimedJSONWebSignatureSerializer(secret_key="python", expires_in=300)

    data = s1.dumps(openid)

    return data.decode()


def decipher(data):

    s1 = TimedJSONWebSignatureSerializer(secret_key="python", expires_in=300)

    try:
        openid = s1.loads(data)

    except Exception as e:
        return None

    return openid